home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / src890906.arc / MKDEP.C < prev    next >
C/C++ Source or Header  |  1989-08-13  |  688b  |  37 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. char include[] = "#include";
  5. main(argc,argv)
  6. int argc;
  7. char *argv[];
  8. {
  9.     int i;
  10.     FILE *fp;
  11.     char buf[512],*cp,*cp1;
  12.  
  13.     for(i=1;i<argc;i++){
  14.         strcpy(buf,argv[i]);
  15.         if((cp = strchr(buf,'.')) == NULL)
  16.             continue;
  17.         *cp = '\0';
  18.         printf("%s.obj: %s",buf,argv[i]);
  19.         fp = fopen(argv[i],"r");
  20.         while(fgets(buf,512,fp) != NULL){
  21.             if(strncmp(buf,include,sizeof(include)-1) != 0)
  22.                 continue;
  23.             if((cp = strchr(buf,'\"')) == NULL)
  24.                 continue;
  25.             cp++;
  26.             if((cp1 = strchr(cp,'\"')) == NULL)
  27.                 continue;
  28.             putchar(' ');
  29.             while(cp != cp1)
  30.                 putchar(*cp++);
  31.         }
  32.         putchar('\n');
  33.         fclose(fp);
  34.     }
  35.     return 0;
  36. }
  37.